<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>执行核查</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <style>
        table {
            border-collapse:separate;
            border-spacing:6px;
        }
    </style>
</head>
<body>
<div style="padding:5px;margin: 0 auto;text-align: center">
    <#if prisonerHc.failurenum ?? && prisonerHc.failurenum == "2">
        <font color="#dc143c">* 此核查人员为二次核查失败原侦查机关所在地数据</font>
    </#if>
</div>
<form id="form1" method="post" style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;">
    <!-- 用户编辑框START-->
    <div id="hjHc" class="form" style="padding:10px;">
        <input name="id" id="id" class="mini-hidden" value="${prisonerHc.id}" style="width: 100%" />
        <input name="priNum" id="priNum" class="mini-hidden" value="${prisonerHc.prinum}" style="width: 100%" />
        <table class="form-table" align="center" style="table-layer:fixed">
            <tr>
                <td style="white-space:nowrap">户籍地址:</td>
                <td>
                    <#if prisonerHc.addr == "01">
                        <span class="check-content-7395">${prisonerHc.nativeName!''}</span>
                    <#elseif prisonerHc.addr == "02" >
                        <span class="check-content-7395">${prisonerHc.nativeName!''}</span>
                    <#elseif prisonerHc.addr == "03" >
                        户籍为监所
                    <#elseif prisonerHc.addr == "04" >
                        户籍为非大陆籍
                    </#if>
                </td>
            </tr>
            <#if prisonerHc.addr == "02" || prisonerHc.addr == "01">
                <#if "${localCode !''}" == "140000">
                    <td style="white-space:nowrap">日常居住地:</td>
                    <td>
                        <span class="check-content-7395">${prisonerHc.placeName!''}</span>
                    </td>
                <#else>
                    <td style="white-space:nowrap">居住地址:</td>
                    <td>
                        <span class="check-content-7395">${prisonerHc.placeName!''}</span>
                    </td>
                </#if>
            </#if>
            <#if prisonerHc.addr == "03">
                <td style="white-space:nowrap">监所地址:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.placeName!''}</span>
                </td>
            </#if>
            <#if prisonerHc.addr == "04">
                <td style="white-space:nowrap">逮捕机构:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.nativeName!''}</span>
                </td>
            </#if>
            <tr>
                <td style="white-space:nowrap">罪犯姓名:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.name!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">曾用姓名:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.usedName!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.sex!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">身份号码:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.idnum!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起核查人员姓名:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.startCheckPerson!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起核查人员固话:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.startCheckTel!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起核查人员手机号码:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.startCheckPhone!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起核查时间:</td>
                <td>
                    <span class="check-content-7395">${prisonerHc.startCheckTime!''}</span>
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">区县司法局备注信息:</td>
                <td>
                    ${qxsfjReason!'暂无'}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">地市司法局备注信息：</td>
                <td>
                    ${dssfjReason!'暂无'}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">司法厅备注信息:</td>
                <td>
                    ${sftReason!'暂无'}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap"><font color="#dc143c">*</font>备注信息:</td>
                <td>
                    <textarea id="priReason" name="priReason" style="width: 100%;" class="mini-textarea"
                              emptyText="请输入备注" value="${prisonerHc.priReason!''}"></textarea>
                </td>
            </tr>
        </table>
    </div>
    <div>
        <table class="form-table" align="center">
            <tr>
                <td><font color="#dc143c">*</font>审核人员:</td>
                <td class="input">
                    <input name="conmectuserName" id="conmectuserName" value="${conmectuserName!''}"
                           style="width: 120px" class="mini-textbox" required="true" />
                </td>
                <td>审核人员手机号码:</td>
                <td class="input">
                    <input name="conmectuserPhone" id="conmectuserPhone" value="${conmectuserPhone!''}" emptyText="请输入手机号码"
                           onvaluechanged="checkPhone(2)" style="width: 110px" class="mini-textbox" required="false" />
                </td>
                <td>审核人员固话:</td>
                <td class="input">
                    <input name="conmectuserTelphone" id="conmectuserTelphone" value="${conmectuserTelphone!''}" emptyText="请输入固定电话"
                           onvaluechanged="checkPhone(1)" style="width: 110px" class="mini-textbox" required="false" />
                </td>
            </tr>
            <tr></tr>
        </table>
    </div>
    <div style="padding:5px;margin: 0 auto;text-align: center">
        <a class="mini-button" iconCls="fa-save" plain="true" style="font-size: 15px"
           onclick="saveData('-1')">保存</a>
        <a class="mini-button" iconCls="fa-save" plain="true" style="font-size: 15px"
           onclick="saveSuccessData()">核查成功</a>
        <#if prisonerHc.failurenum ?? && prisonerHc.failurenum != "2">
            <a class="mini-button" iconCls="fa-save" plain="true" style="font-size: 15px"
               onclick="saveFailureData()">核查失败</a>
        </#if>
    </div>
    <input type="hidden" value="${failurenum!''}" id="aaa"/>
</form>
<script type="text/javascript">
    mini.parse();
    var form = new mini.Form("form1");
    var conmectuserPhone = mini.get("conmectuserPhone");
    var priReason = mini.get("priReason");
    var conmectuserTelphone = mini.get("conmectuserTelphone");

    function saveSuccessData() {
        saveData("3")
    }

    function saveFailureData() {
        saveData("4")
    }

    function saveData(state) {
        form.validate();
        var phone = conmectuserPhone.getValue();
        var telPhone = conmectuserTelphone.getValue()
        var newPhone = checkTelAndPhone(telPhone,phone);
        var flag = newPhone['flag'];
        var kflag = newPhone['kflag'];
        if ('-1' === kflag) {
            mini.alert("请至少输入一个联系方式");
            return;
        }
        if (flag) {
        } else {
            mini.alert("手机号码或固话有误，请重填");
            return;
        }
        if (priReason.getValue() == "") {
            mini.alert("请输入备注信息");
            return;
        }
        if (form.isValid() == false) {
            return;
        }
        var data = form.getData();
        var json = mini.encode(data);

        if (state == "3"){
            mini.confirm("确定要核查成功?","确定?",function(action){
                if (action == "ok"){
                    commonSaveData("/azbj/verification/hcstate", {
                        data: json,
                        prinum: mini.get("priNum").getValue(),
                        state: state
                    }, callback);
                }else{
                    return;
                }
            })
        }else if (state == "4"){
                mini.confirm("确认操作核查失败吗？此操作不可撤销！！！ 核查失败后无需操作，该数据将自动上报至区县司法局， 可到核查失败列表查看","确定?",function(action){
                    if (action == "ok"){
                        commonSaveData("/azbj/verification/hcstate", {
                            data: json,
                            prinum: mini.get("priNum").getValue(),
                            state: state
                        }, callback);
                    }else{
                        return;
                    }
                })
        } else {
            commonSaveData("/azbj/verification/hcstate", {
                data: json,
                prinum: mini.get("priNum").getValue(),
                state: state
            }, callback);
        }
        // 保存成功的回调函数
        function callback() {
            mini.alert("保存成功", "成功", window.CloseOwnerWindow);
        }
    }

    var rbl = mini.get("nativeRightId");
    if (rbl !== undefined) {
        rbl.on("valuechanged", function (e) {
            if (this.getValue() == 1) {
                document.getElementById("otherHc").style.display = "block";
            } else {
                document.getElementById("otherHc").style.display = "none";
            }
        });
    }

    function checkPhone(e) {
        var phone = conmectuserPhone.getValue();
        var telPhone = conmectuserTelphone.getValue();
        if (e == '1') {
            if(!validateTel(telPhone)) {
                mini.alert("固定电话有误，请重填");
            }
        }
        if (e == '2') {
            if(!validatePhone1(phone)) {
                mini.alert("手机号码有误，请重填");
            }
        }
    }

    $(document).ready(function(){
        checkContent(1);
    });
</script>
</body>
</html>